package com.itheima.reggie.service.impl;

import com.itheima.reggie.dao.UserDao;
import com.itheima.reggie.pojo.User;
import com.itheima.reggie.service.UserService;
import org.aspectj.lang.annotation.Around;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    /**
     * 登录或注册
     *
     * @param phone
     */
    @Override
    public User login(String phone) {
        User user = userDao.findUserByPhone(phone);
        if (user == null) {
            user = new User();
            user.setPhone(phone);
            user.setStatus(1);
            userDao.add(user);
        }
        return user;
    }
}
